package com.demo.project_template.controller;


import com.demo.project_template.base.os.OsService;
import com.demo.project_template.vo.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@Api(tags = "文件上传模块")
@RestController
@RequestMapping("api/upload")
public class UploadFileController {
    @Resource
    private OsService ossService;

    @ApiOperation("文件上传")
    @PostMapping("/uploadFile")
    public R<String> uploadFile(MultipartFile file) throws IOException {
        String s = ossService.uploadFile(file);
        return R.success(s);
    }

}
